/* This file is part of FireEscape.
 *
 * FireEscape is the intellectual work of Phillip Cheng & Allen Park.
 * All future releases or modifications of this program must include this
 * attribuation as according to the Creative Commons BY-SA license.
 *
 * FireEscape is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * any later version.
 *
 * FireEscape is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with FireEscape.  If not, see <http://www.gnu.org/licenses/>.
 *
 * All modifications to this program should include this original statement.
 *
 * If you modify, distribute, or use the program , please contact
 * fireescape@kloudvine.com
 * http://code.google.com/p/fireescape/
 *
 * If you are interested in using FireEscape for your structure, please contact us
 * for support.
 *
 * If you do use FireEscape, please consider donating to the project.
 */
package fireescape;

import java.io.Serializable;
import java.util.List;

/**
 *
 * @author chengP
 */
public class Packet implements Serializable {

    private String command;
    private String serverID;
    private int serverBench;
    private String originIP;
    private int genomeID;
    private List route;
    private boolean iterated;
    private double time;
    private int motherHash = 0;
    private int fatherHash = 0;
    private double motherTime;
    private double fatherTime;
    private Genome genome;
    private String senderID;

    /**
     * Constructs the packet
     * @param senderID
     * @param originIP
     * @param command
     * @param genome
     */
    public Packet(String senderID, String originIP, String command, Genome genome) {
        this.command = command;
        this.genome = genome;
        this.senderID = senderID;
        this.originIP = originIP;
    }

    /**
     *
     * @param command
     */
    public Packet(String command) {
        this.command = command;
    }

    /**
     *
     * @param senderID
     * @param originIP
     * @param command
     * @param serverBench
     */
    public Packet(String senderID, String originIP, String command, int serverBench) {
        this.command = command;
        this.serverBench = serverBench;
        this.originIP = originIP;
        this.senderID = senderID;
    }

    /**
     *
     * @param command
     * @param genome
     */
    public Packet(String command, Genome genome) {
        this.genome = genome;
        this.command = command;

    }

    /**
     *
     * @return
     */
    public String getString() {
        return command;

    }

    /**
     *
     * @return
     */
    public String senderID() {
        return senderID;
    }

    /**
     *
     * @return
     */
    public Genome getGenome() {
        return genome;
    }

    /**
     * @deprecated  As of release 0.9, replaced by {@link #Genome.getGenomeID()}
     * This method is not currently used due to the way the program is oriented.
     * It has been decided to keep the GenomeID with the genome, same as the
     * route Hash
     */
    public int getGenomeID() {
        return genomeID;
    }
}
